#! /bin/sh
set -e
# 获取操作系统类型
os_type=$(uname -s)
echo "os_type: $os_type"
# 操作系统不是Linux退出
if [ "$os_type" != "Linux" ]; then
    echo "This script only supports Linux"
    exit 1
fi
# 判断当前用户是否为root，不是则退出
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, please use root to install, you can use the command: sudo -i to login root user"
    echo "Error: 请使用root用户运行,你可以使用命令: sudo -i 切换到root用户."
    exit 1
fi
# 卸载config-deliver服务
systemctl stop config-deliver
systemctl disable config-deliver
rm -f /etc/systemd/system/config-deliver.service
systemctl daemon-reload
systemctl reset-failed
echo "config-deliver服务卸载完成"
